<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动(3)</title>
    <style>
        .box:before,
        .box:after{
            content:"";
            display: table;
        }

        .box:after{
            clear:both;
        }

        .box{
            width: 800px;
            border: 2px blue solid;
        }
        .box>div{
            background-color: skyblue;
            width: 200px;
            height: 200px;
            float: left;
            margin-left: 8px;
            margin-bottom: 8px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
</html>